<extend name="./Application/Home/View/master.html" />
<block name="title">
    <script type="text/javascript">
        $(function (){
            initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, '11', '1101', '0');
        });

        //得到地区码
        function getAreaID(){
            var area = 0;
            if($("#seachdistrict").val() != "0"){
                area = $("#seachdistrict").val();
            }else if ($("#seachcity").val() != "0"){
                area = $("#seachcity").val();
            }else{
                area = $("#seachprov").val();
            }
            return area;
        }

        function showAreaID() {
            //地区码
            var areaID = getAreaID();
            //地区名
            var areaName = getAreaNamebyID(areaID) ;
//            将三级联动压入隐藏域
            $("#dizhi").val(areaName);
            //收件人姓名
            var name=$("#name").val();
            //收件人地址
            var dizhi=$("#dizhi").val();
            //详细地址
            var particular=$('#particular').val();
            //邮编
            var postcode=$("#postcode").val();
            //手机号
            var mobile=$("#shouji").val();
            $.post("{:u('AjaxSite')}",{name:name,dizhi:dizhi,particular:particular,postcode:postcode,mobile:mobile},function (res) {
                if(res){
                    history.go(0)
                }else{
                    '输入的信息有误';
                }
            },"json")
//            alert("您选择的地区码：" + areaID + "      地区名：" + areaName);
        }

        //根据地区码查询地区名
        function getAreaNamebyID(areaID){
            var areaName = "";
            if(areaID.length == 2){
                areaName = area_array[areaID];
            }else if(areaID.length == 4){
                var index1 = areaID.substring(0, 2);
                areaName = area_array[index1] + " " + sub_array[index1][areaID];
            }else if(areaID.length == 6){
                var index1 = areaID.substring(0, 2);
                var index2 = areaID.substring(0, 4);
                areaName = area_array[index1] + " " + sub_array[index1][index2] + " " + sub_arr[index2][areaID];
            }
            return areaName;
        }



    </script>
    <div class="body-center">
        <div class="center-content">
            <!--头部开始-->
            <div class="content-header">
                <p>收获地址  <span>温馨提示：为了保证您的权益，防止黄牛倒卖，订单进入正在配货状态将不能修改收货地址和发票信息！</span></p>
            </div>
            <!--头部结束-->
            <!--地址选择开始-->
            <div class="content-address">
                <volist name="ses['site']" id="vo">
                <div class="consignee-item">
                    <span class="radio-img "></span>
                    <label for="adress1" class="radio">
                        <input type="radio" name="adress"  id="adress1" <if condition="$vo.ifdefault==1">checked</if> class="radio-select" value=""/><span class="e-name">{$vo['name']}</span>，<span class="city dizhi">{$vo['dizhi']}</span><span class="city-particular">{$vo['particular']}</span>，<span class="codeNumber">{$vo['mobile']}</span>
                        <input type="text" name="EditPostcode" hidden id="ep" value="{$vo['postcode']}">
                    </label>
                    <span class="compile"><a class="copyreader" href="javascript:;">编辑</a></span>
                </div>
                </volist>
                <script>
                    $('.radio input').click(function () {
                        var name = $(this).parents('.consignee-item').find('.e-name').html();
                        var cityParticular = $(this).parents('.consignee-item').find('.city-particular').html();
                        var codeNumber = $(this).parents('.consignee-item').find('.codeNumber').html();
                        var city = $(this).parents('.consignee-item').find('.dizhi').html();
//                        message:
//                        {name: "孟庆国", cityParticular: "舍伯吐镇", codeNumber: "13624753424", city: "内蒙古 通辽市 科尔沁左翼中旗"}
//                        city:"内蒙古 通辽市 科尔沁左翼中旗"
//                        cityParticular:"舍伯吐镇"
//                        codeNumber:"13624753424"
//                        name:"孟庆国"
//                        valid:1
//                        <p>寄送至：<span class="m-city">aa</span><span class="m-particular">孙河 顺白路12号 后盾it教育</span></p>
//                        <p><span class="m-name">贾博雨</span> (收件人) <span class="m-number">15600266727</span> </p>
                        $.post("{:u('AjaxOrder')}",{name:name,cityParticular:cityParticular,codeNumber:codeNumber,city:city},function (res) {
                            $('span.m-city').html(res.message.city);
                            $('span.m-particular').html(res.message.cityParticular);
                            $('span.m-name').html(res.message.name);
                            $('span.m-number').html(res.message.codeNumber);

//                            alert(1)
//                            console.log(res.message.city);
                        },'json');

                    })
                </script>
                <!--添加新地址-->

                <div class="consignee-item new-ress">
                    <span class="radio-img"></span>
                    <label for="adress3" class="radio"><input type="radio" name="adress" id="adress3" class="radio-select"  value=""/>使用新地址</label>
                </div>
                <!--添加地址框-->

                <div class="add-address new">
                    <form action="AjaxSite" method="post">
                        <div class="s-name">
                            <h3 class="style"><b>*</b>收货人姓名</h3>
                            <input type="text" class="public" name="name" id="name" placeholder="收货人姓名" value="" />
                        </div>
                        <div class="address-s">
                            <h3 class="style"><b>*</b>地址</h3>

                            <!--城市联动-->
                            <select id="seachprov" name="seachprov" onChange="changeComplexProvince(this.value, sub_array, 'seachcity', 'seachdistrict');"></select>&nbsp;&nbsp;
                            <select id="seachcity" name="homecity" onChange="changeCity(this.value,'seachdistrict','seachdistrict');"></select>&nbsp;&nbsp;
                            <span id="seachdistrict_div"><select id="seachdistrict" name="seachdistrict"></select></span>
                            <!--<input type="text" name="name" id="name" placeholder="收货人姓名" value="" />-->
                            <textarea name="particular" placeholder="路名或街道地址，门牌号 " id="particular" rows="" cols=""></textarea>
                        </div>

                        <div class="postcode">
                            <h3 class="style"><b>&nbsp;</b>邮政编码</h3>
                            <input type="text" class="public" name="postcode" id="postcode" placeholder="6位邮政编码" value="" />
                        </div>
                        <div class="shouji">
                            <h3 class="style"><b>*</b>手机号码 </h3>
                            <input type="text" class="public" name="mobile" id="shouji" placeholder="11位手机号码" value="" />
                        </div>
                        <div class="btn-group">
                            <input type="text" hidden name="dizhi" id="dizhi" value="">
                            <input type="button" class="btn" id="btn-bao" onClick="showAreaID()"; value="保存">
                            <!--<input type="submit"  class="btn" id="btn-bao" value="保存"/>-->
                            <a href="javascript:;" class="btn-qu btn">取消</a>
                        </div>

                    </form>
                </div>

                <!--添加地址按钮-->
                <a href="javascript:;" class="new-address"></a>
                <!--添加新地址结束-->
                <!--编辑开始-->
                <div class="add-address edit">
                    <form action="" method="post">
                        <div class="s-name">
                            <h3 class="style"><b>*</b>收货人姓名</h3>
                            <input type="text" class="public" name="name" id="name" placeholder="收货人姓名" value="" />
                        </div>
                        <div class="address-s">
                            <h3 class="style"><b>*</b>地址</h3>

                            <!--城市联动-->
                            <!--<input type="text" name="name" id="name" placeholder="收货人姓名" value="" />-->
                            <textarea name="particular" placeholder="路名或街道地址，门牌号 " id="particular" rows="" cols=""></textarea>
                        </div>

                        <div class="postcode">
                            <h3 class="style"><b>&nbsp;</b>邮政编码</h3>
                            <input type="text" class="public" name="postcode" id="postcode" placeholder="6位邮政编码" value="" />
                        </div>
                        <div class="shouji">
                            <h3 class="style"><b>*</b>手机号码 </h3>
                            <input type="text" class="public" name="shouji" id="shouji" placeholder="11位手机号码" value="" />
                        </div>
                        <div class="btn-group">
                            <input type="submit"  class="btn" id="btn-bao" value="保存"/>
                            <a href="javascript:;" class="btn-qu btn">取消</a>
                        </div>

                    </form>
                </div>
            </div>
            <!--地址选择结束-->


            <!--选项开始-->
            <div class="options">
                <div class="options-all">
                    <div class="payment options-public">
                        <h3>支付方式</h3>
                    </div>
                    <div class="consignee-item new-ress">
                        <span class="radio-img pitchOn"></span>
                        <label for="payment" class="radio w122"><input type="radio" name="payment" id="payment" class="radio-select"  value=""/>在线支付</label>
                    </div>
                </div>
                <div class="options-all">
                    <div class="distribution options-public">
                        <h3>配送方式</h3>
                    </div>
                    <div class="consignee-item new-ress">
                        <span class="radio-img pitchOn"></span>
                        <label for="distribution" class="radio w122"><input type="radio" name="distribution" id="distribution" class="radio-select"  value=""/>免费配送</label>
                    </div>
                </div>
                <div class="options-all invoice">
                    <div class=" options-public">
                        <h3>发票信息</h3>
                    </div>
                    <div class="box-all" style="overflow: hidden;">
                        <div class="consignee-item new-ress left">
                            <span class="radio-img pitchOn"></span>
                            <label for="invoice" class="radio w122 no"><input type="radio" name="invoice" id="invoice" class="radio-select "  value=""/>不开发票</label>
                        </div>
                        <div class="consignee-item new-ress left">
                            <span class="radio-img "></span>
                            <label for="invoice1" class="radio w122 yes"><input type="radio" name="invoice" id="invoice1" class="radio-select "  value=""/>普通发票</label>

                        </div>
                    </div>
                    <div class="con">
                        <div class="text">发票内容：购买商品明细</div>
                        <div class="text">发票抬头：请确认单位名称正确，以免因名称错误耽搁您的报销。</div>
                        <div class="box-all" style="overflow: hidden; margin-top: 10px;">
                            <a href="javascript:;" class="geren tongyong active">个人</a>
                            <a href="javascript:;" class="danwei tongyong">单位</a>
                        </div>
                        <div class="danweiname" >
                            <div class="text">单位名称：</div>
                            <input type="text" name="danweiname" id="danweiname" value="" />
                        </div>
                    </div>
                </div>

            </div>
            <!--选项结束-->
            <div class="options-all  goods">
                <div class="qingdan options-public" style="border: none;">
                    <h3>商品清单</h3>
                </div>
                <div class="goodsList">
                    <div class="title">
                        <ul>
                            <li class="l1">商品名称</li>
                            <li class="l2">单价</li>
                            <li class="l3">数量</li>
                            <li class="l4">合计</li>
                        </ul>
                    </div>
                </div>

                <div class="goods-cont">
                    <ul>
                        <volist name="ses['order']['order']" id="vo">
                        <li style="padding: 13px;">
                            <div class="gc1">
                                <img src="__ROOT__/{$vo['pic']}"/>
                                <span>
                                    {$vo['name']}/
                                    <volist name="vo['options']" id="n">
                                    {$key}/{$n}/
                                    </volist>
                                </span>
                            </div>
                            <div class="gc2">
                                ¥
                                <span>{$vo['price']}</span>
                            </div>
                            <div class="gc3">
                                X
                                <span>{$vo['num']}</span>
                            </div>
                            <div class="gc4">
                                ¥
                                <span>{$vo['total']}</span>
                            </div>
                        </li>
                        </volist>
                    </ul>
                </div>

                <!--总计-->
                <div class="zongji">
                    <ul>
                        <li>
                            共<span class="color">{$ses['order']['total_rows']}</span>件
                        </li>
                        <li>
                            金额合计：<span>{$ses['order']['total']}</span>元
                        </li>
                        <!--<li>-->
                            <!--优惠抵扣：<span>-0.00</span>元-->
                        <!--</li>-->
                        <li>
                            配送费：<span>0</span>元
                        </li>
                        <li style="margin-top: 15px;">
                            <h3>应付总金额：<span class="color">{$ses['order']['total']}</span>元</h3>
                        </li>
                    </ul>
                </div>
                <!--确认地址-->
                <div class="mailTo">
                    <p>寄送至：<span class="m-city"></span><span class="m-particular"></span></p>
                    <p>(收件人)<span class="m-name"></span>&nbsp;&nbsp;&nbsp;&nbsp;联系电话：<span class="m-number"></span> </p>
                </div>
                <div class="" style="overflow: hidden;">
                    <a href="javascript:;" class="liji" id="ljxd">立即下单</a>
                </div>
                <script>
                    $('#ljxd').click(function () {
                        alert(1)
                    })
                </script>
            </div>


        </div>
    </div>
</block>
<!--<script>-->
    <!--$(function () {-->
        <!---->
    <!--})-->
<!--</script>-->